/*
 * @Author: 李超越 1509572300@qq.com
 * @Date: 2024-07-23 18:49:37
 * @LastEditors: 李超越 1509572300@qq.com
 * @LastEditTime: 2024-07-24 13:00:39
 * @FilePath: /my_git/lesson23_buffer/mystdio.h
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#pragma once
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>

#define SIZE 4096
#define NONE_FLUSH  (1<<1)
#define LINE_FLUSH  (1<<2)
#define FULL_FLUSH  (1<<3)

typedef struct _myFILE
{
    char inbuffer[SIZE];
    char outbuffer[SIZE];
    int pos;
    int cap;
    int flush_mode;
    int fileno;
}myFILE;

myFILE* my_fopen(const char* pathname,const char*mode);
int my_fwrite(myFILE *fp,const char *s,int size);

void my_close(myFILE* fp);